import axios from 'axios';
let baseUrl = 'http://3y5482718m.wicp.vip:12043'
// let baseUrl = 'http://172.20.31.139:3000'

//获取失物列表
export function getLostList(id){
    if(id==undefined){
        return axios.get(`${baseUrl}/lostList`)
    }else{
        return axios.get(`${baseUrl}/lostList?id=${id}`)
    }
}

//获取指定失物项
export function getLostListByNo(no){
    return axios.get(`${baseUrl}/lostList?no=${no}`)
}


//获取搜索
export function getSearch(word){
    return axios.get(`${baseUrl}/search?word=${word}`)
}

//登录
export function login(email,pw){
    return axios.get(`${baseUrl}/login?id=${email}&pw=${pw}`)
}

//注册用户
export function regUser(email,name,password){
    return axios.get(`${baseUrl}/addUser?email=${email}&name=${name}&pw=${password}`)
}

//删除事项
export function deletList(no){
    return axios.get(`${baseUrl}/del?no=${no}`)
}

//获取no最大值
export function listNumMax(){
    return axios.get(`${baseUrl}/listNumMax`)
}

//添加失物
export function addLost(no,email,date,name,des,tel,LorF){
    return axios.get(`${baseUrl}/addLost?no=${no}&email=${email}&date=${date}&name=${name}&des=${des}&tel=${tel}&LorF=${LorF}`)
}

///addLost?no=10&email=760523867@qq.com&date=1111&name=2&des=22&tel=222&LorF=find

//更新失物项
export function upList(no,name,des,tel,LorF){
    return axios.get(`${baseUrl}/update?no=${no}&name=${name}&des=${des}&tel=${tel}&LorF=${LorF}`);
}

//改名字
export function changeName(email,name){
    return axios.get(`${baseUrl}/userChange/name?email=${email}&name=${name}`);
}



